#!/bin/bash

function func1()
{
    echo $BASHPID func1 called
    func2
}

func2()
{
    echo $BASHPID func2 called
    return 0
}


echo -e "\n"
echo $BASHPID

echo -e "\n"
func1

echo -e "\n"
true | while func2; do
    echo $BASHPID
    break
done

echo -e "\n"
while func2; do
    echo $BASHPID
    break
done

echo -e "\n"
func2 &


echo -e "\n"
main()
{
    echo main: $1 $2
    echo main_all: $*
    local a=1
    b=$a
    echo main a: $a
    echo main b: $b
    return $3
}

echo -e "\n"
echo before: $1 $2
echo -e "\n"
main $*
echo return: $?
echo -e "\n"
echo out a: $a
echo out b: $b
